package com.LostAndFound.service;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import com.LostAndFound.dao.FailureRecodListDao;

public class FailureRecodListService {
	FailureRecodListDao dao = new FailureRecodListDao();

	// 得到记录条数
	public int getTotalRecordForEasyUI(String cid, String whatFlag) {
		int total = 0;
		try {
			total = dao.getTotalRecordForEasyUI(cid,whatFlag);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return total;
	}

	public List<Map<String, Object>> failureRecordListForEasyUI(int pageNumber, int pageSize, String cid,
			String whatFlag) {
		List<Map<String, Object>> mapList = null;
		int startIndex = (pageNumber-1)*pageSize;
		try {
			mapList = dao.getRecodListForEasyUI(startIndex,pageSize,cid,whatFlag);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return mapList;
	}

	public boolean handleDeleteFailureRecordForEasyUI(String aid) {
		boolean success = false;
		try {
			dao.handleDeleteFailureRecordForEasyUI(aid);
			success = true;
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return success;
	}

}
